using first derivative test